// user.js 作用是存放和用户相关的请求
import request from '@/utils/request'
// import store from '@/store'

// 注册的请求
export const regAPI = obj => {
  return request.post('/api/reg', obj)
}

// 登录的请求
export const loginAPI = obj => {
  return request.post('/api/login', obj)
}

// 获取用户信息
export const getUserAPI = () => {
  // return request.get('/my/userinfo', {
  //   headers: { Authorization: store.state.user.token }
  // })
  return request.get('/my/userinfo')
}

// 更新用户信息请求
export const updateUserAPI = data => {
  return request.put('/my/userinfo', data)
}

// 重置密码请求
export const updatePwdAPI = data => {
  return request.patch('/my/updatepwd', data)
}

// 更换头像请求
export const updateImgAPI = base64 => {
  return request.patch('/my/update/avatar', { avatar: base64 })
}
